package com.boarsoft.boar.batch.demo.flow;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.boarsoft.boar.batch.demo.biz.DemoBatchBiz;
import com.boarsoft.flow.core.bean.ProcessHandler;
import com.boarsoft.hibernate.biz.SimpleBizImpl;

public class DemoFlowBatchProcess3 extends SimpleBizImpl implements ProcessHandler {
	@Autowired
	protected DemoBatchBiz biz;

	/**
	 * 查询一页数据
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Object process(String entry, Object data, Throwable throwable) throws Throwable {
		Map<String, Object> pm = (Map<String, Object>) data;
		final int pageCount = (Integer) pm.get("pageCount");
		if (pageCount > 100) {
			throw new Exception("Pages are too much");
		}
		pm.put("list", biz.list(500));
		return pm;
	}
}
